<?php

namespace account;

use Exception;
abstract class Account {
	private $name;
	private $percent;
	private $period;
	private $sum;
	private $balance;
	public function setName($name) {
		if (! is_string ( $name )) {
			throw new Exception ( 'Accaunt must be string' );
		}
		$this->name = $name;
	}
	public function getName() {
		return $this->name;
	}
	public function setPercent($percent) {
		if (is_string ( $percent )) {
			throw new Exception ( "Percent can not be string." );
		}
		if (! is_numeric ( $percent )) {
			throw new Exception ( "Percent must be numeric." );
		}
		if ($percent < 0) {
			throw new Exception ( "Percent must be positive number." );
		}
		$this->percent = $percent;
	}
	public function getPercent() {
		return $this->percent;
	}
	public function setPeriod($period) {
		if (is_string ( $period )) {
			throw new Exception ( "Period can not be string." );
		}
		if (! is_numeric ( $period )) {
			throw new Exception ( "Period must be numeric." );
		}
		if ($period < 1 || $period > 60) {
			throw new Exception ( "Period must be a number between 1 and 60." );
		}
		$this->period = $period;
	}
	public function getPeriod() {
		return $this->period;
	}
	public function setSum($sum) {
		if (is_string ( $sum )) {
			throw new Exception ( "Month sum can not be string." );
		}
		if (! is_numeric ( $sum )) {
			throw new Exception ( "Month sum must be numeric." );
		}
		if ($sum < 0) {
			throw new Exception ( "Month sum must be positive number." );
		}
		$this->sum = $sum;
	}
	public function getSum() {
		return $this->sum;
	}
	public abstract function setBalance($balance);
	
}
